package customer_manage_function_implementation;

import java.util.Collections;
import java.util.LinkedList;

import customer_manage_database.Customer;



public class OrderCustomer {
	
	//根据ID/Name进行排序
//	public LinkedList<Customer> orderCustomers(String[] str,LinkedList<Customer> lList){
//		if (str.length==1 && str[0].equals("NAME")) {
//			Collections.sort(lList,new CustomerIdComparator());						
//		}else if (str.length==1 && str[0].equals("ID")) {
//			Collections.sort(lList,new CustomerNameComparator());
//		}else {
//			System.out.println("Command Error!!");
//		}
//		return lList;
//	}

	public LinkedList<Customer> orderCustomers(String[] str,
			LinkedList<Customer> lList) {
		// TODO Auto-generated method stub
		if (str.length==1 && str[0].equals("ID")) {
			Collections.sort(lList,new CustomerIdComparator());						
		}else if (str.length==1 && str[0].equals("NAME")) {
			Collections.sort(lList,new CustomerNameComparator());
		}else {
			System.out.println("Command Error!!");
		}
		return lList;
	}

}
